<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript" src="js/datepickr.js"></script>
<link rel="stylesheet" type="text/css" href="css/datepickr.css">

<title>Update Gold Rates</title>
</head>
<body>
	<center>
		<h3>Enter Daily Gold rate Details Here</h3>
		<c:if test="${isNewRate != null}">
			<form:form method="POST" action="addGoldRate"
				modelAttribute="goldRateAttribute">
				<table width="50%" align="center">
					<tr>
						<td>Date</td>
						<td><form:input path="goldRateDate" readonly="true" /></td>
						<td><form:errors path="goldRateDate"></form:errors></td>
					</tr>
					<tr>
						<td>22K Gold Rate</td>
						<td><form:input path="twentyTwoKaratForGram" /></td>
						<td><form:errors path="twentyTwoKaratForGram"></form:errors></td>
					</tr>
					<tr>
						<td>24K Gold Rate</td>
						<td><form:input path="twentyFourKaratForGram" /></td>
						<td><form:errors path="twentyFourKaratForGram"></form:errors></td>
					</tr>
					<tr>
						<td colspan="2"><input type="submit" value="Add Gold Rate"></td>
					</tr>
					<tr>
						<td colspan="2">Result: <c:if test="${status != null} ">
								<c:out value="${status}"></c:out>
							</c:if></td>
					</tr>
				</table>
			</form:form>
		</c:if>
		<c:if test="${isNewRate == null}">
			<form:form method="POST" action="updateGoldRate"
				modelAttribute="goldRateAttribute">
				<form:hidden path="goldRateId" />
				<table width="50%" align="center">
					<tr>
						<td>Date</td>
						<td><form:input path="goldRateDate" readonly="true" /></td>
						<td><form:errors path="goldRateDate"></form:errors></td>
					</tr>
					<tr>
						<td>22K Gold Rate</td>
						<td><form:input path="twentyTwoKaratForGram" /></td>
						<td><form:errors path="twentyTwoKaratForGram"></form:errors></td>
					</tr>
					<tr>
						<td>24K Gold Rate</td>
						<td><form:input path="twentyFourKaratForGram" /></td>
						<td><form:errors path="twentyFourKaratForGram"></form:errors></td>
					</tr>
					<tr>
						<td colspan="2"><input type="submit" value="Update Gold Rate"></td>
					</tr>
					<tr>
						<td colspan="2">Result: <c:if test="${status != null} ">
						Result:
								<c:out value="${status}"></c:out>
							</c:if></td>
					</tr>
				</table>
			</form:form>
		</c:if>
	</center>
</body>
</html>
